package pattern.facade;

import java.util.logging.Logger;

public class TestFacade {
    public static final Logger LOGGER = Logger.getLogger(String.valueOf(TestFacade.class));
    public static void main(String[] args)
    {
        Computer computer = new Computer();
        computer.start();
        LOGGER.info("=================");
        computer.shutDown();
    }
}

/**
 * cpu子系统类
 * @author Administrator
 *
 */
 class CPU
{
    public static final Logger LOGGER = Logger.getLogger(String.valueOf(CPU.class));
    public void start()
    {
        LOGGER.info("cpu is start...");
    }

    public void shutDown()
    {
        LOGGER.info("CPU is shutDown...");
    }
}
/**
 * Disk子系统类
 * @author Administrator
 *
 */
 class Disk
{
    public static final Logger LOGGER = Logger.getLogger(String.valueOf(Disk.class));
    public void start()
    {
        LOGGER.info("Disk is start...");
    }

    public void shutDown()
    {
        LOGGER.info("Disk is shutDown...");
    }
}
/**
 * Memory子系统类
 * @author Administrator
 *
 */
 class Memory
{
    public static final Logger LOGGER = Logger.getLogger(String.valueOf(Memory.class));
    public void start()
    {
        LOGGER.info("Memory is start...");
    }

    public void shutDown()
    {
        LOGGER.info("Memory is shutDown...");
    }
}

/**
 * 门面类（核心）
 * @author Administrator
 *
 */
 class Computer
{
    public static final Logger LOGGER = Logger.getLogger(String.valueOf(Computer.class));

    private CPU cpu;
    private Memory memory;
    private Disk disk;
    public Computer()
    {
        cpu = new CPU();
        memory = new Memory();
        disk = new Disk();
    }
    public void start()
    {
        LOGGER.info("Computer start begin");
        cpu.start();
        disk.start();
        memory.start();
        LOGGER.info("Computer start end");
    }

    public void shutDown()
    {
        LOGGER.info("Computer shutDown begin");
        cpu.shutDown();
        disk.shutDown();
        memory.shutDown();
        LOGGER.info("Computer shutDown end...");
    }
}
